var table;
layui.use('table',function(){
    table=layui.table;
});
sousuo();
function sousuo(){
    var name=$("#name").val();
    var course=$("#course").val();
    var price=$("#price").val();
    $.ajax({
        url:"/Teacher/selComments",
        type:"get",
        dataType:"json",
        data:{"name":name,"course":course,"price":price},
        success:function(data){
            console.log(data)
            getTable(data.obj);
        }
    })
}
function getTable(data) {
    console.log(data)
    table.render({
        elem: "#table_id",
        title: "表格",
        limit: 10,
        page: true,
        data:data,
        cols: [[
            {type: 'checkbox', fixed: 'left'},
            {field: 'commodity_id', title: '编号', fixed: 'left', width: 120},
            {field: 'account', title: '用户名称', fixed: 'left', width: 120},
            {field: 'product_name', title: '课程名称', width: 120},
            {field: 'content', title: '评价', width: 120},
            {field: 'Comment_date', title: '评论时间', width: 120},
            {field: 'account', title: '用户账号', width: 120},
            {field: '', title: '操作', width: 180, templet: function (d) {
                    return "<span onclick='chakan()'>查看</span>"+
                        "<span onclick='shanchu()'>删除</span>";
                }
            }
        ]]
    });
}
function chakan(){
    layer.open({
        type : 2,//弹出层的类型
        id:1,
        title : "<div style='color:#666666;font-weight: 600;background: #F8F8F8;'>评论详情</div>",
        area : [ '1000px', '700px' ],
        maxmin: true,
        shade : 0,
        offset: 'auto',
        content :"Comments.html",
        success:function(layero,index){

        }
    });
}
function shanchu(){

}